'use strict'
//Excel下载
import axios from 'axios'
import {baseUrl} from './api.js'

const url = {
  downloadEasyExcel: '/easy_excel/downloadEasyExcel',
  exportProjectDoctor:'/easy_excel/downloadDoctorProductExcel'
}

const httpExcel = function (api, data) {
  return axios({
    url: baseUrl + api,
    method: 'post',
    data: data,
    responseType: 'blob',
  })
}

const httpForm = function (api, obj, formData) {
  return axios({
    url: baseUrl + api,
    method: 'post',
    data: formData,
    params: {
      workOrderBeanData: obj
    },
    headers: {'Content-Type': 'multipart/form-data'}
  })
}

const httpFormUpload = function (api, obj, formData, callBack) {
  return axios({
    url: baseUrl + api,
    method: 'post',
    data: formData,
    params: obj,
    headers: {'Content-Type': 'multipart/form-data'}
  }).then(function(res){
    callBack(res);
  });
}

const upload = function (api, formData, callBack) {
  return axios({
    url: baseUrl + api,
    method: 'post',
    data: formData,
    headers: {'Content-Type': 'multipart/form-data'}
  }).then(function(res){
    callBack(res);
  });
}


export {url, httpExcel, httpForm, httpFormUpload, upload}
